﻿<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
    <title>用户列表</title>
    <link href="${pageContext.request.contextPath}/css/houtaimain.css" rel="stylesheet" type="text/css">
    <link href="${pageContext.request.contextPath}/bstable/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="${pageContext.request.contextPath}/bstable/css/bootstrap-table.css" rel="stylesheet" type="text/css">

</head>
<from>
<p class="tabe_div">
 <form action="${pageContext.request.contextPath}/user/ByUsername" method="post">
    <p class="p_line text_ient"><a class="find_a">按学号：</a><input type="text" name="username" class="form_input text_ient" placeholder="输入学号"/>

    <input type="submit" value="查询" class="but_find"/></p></from>

     <p>  按昵称：</a> <form action="${pageContext.request.contextPath}/user/ByNikeName" method="post"><input type="text" name="nikename" class="form_input text_ient" placeholder="输入昵称"/>
        <input type="submit" value="查询" class="but_find"/></form></p>
    <p class="p_table">
        <a href="${pageContext.request.contextPath}/user/into-add" class="a_add"  >添加</a><a href="${pageContext.request.contextPath}/excel/in" class="a_add">导入用户信息</a>
    </p>
</div>
    <table id="table" >
       <c:forEach items="${list}" var="user">
        <tr>
            <td >${user.id}</td>
            <td >${user.username}</td>
            <td ><img src="${user.photo}" style="height: 40px;width: 60px"></td>
            <td >${user.phone}</td>
            <td >${user.address}</td>
            <td >${user.nickname}</td>
            <td><a  onclick="if(confirm('重置后密码为123，是否重置?')){return true;}else{return false;}" href="${pageContext.request.contextPath}/user/updatePasswordAdmin?id=${user.id}"><strong>重置用户密码</strong></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <a  onclick="if(confirm('删除该用户后，与该用户有关记录都将会被删除，是否删除?')){return true;}else{return false;}" href="${pageContext.request.contextPath}/user/deleteUser?id=${user.id}"><strong>删除</strong></a></td>
        </tr>
       </c:forEach>
    </table>


</div>
<div></div>
<script src="${pageContext.request.contextPath}/js/jquery.js"></script>
<script src="${pageContext.request.contextPath}/js/date/js/laydate.js"></script>
<script src="${pageContext.request.contextPath}/bstable/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/bstable/js/bootstrap-table.js"></script>
<script src="${pageContext.request.contextPath}/bstable/js/bootstrap-table-zh-CN.min.js"></script>
<script>
    !function () {
        laydate.skin('danlan'); //切换皮肤，请查看skins下面皮肤库
        laydate({ elem: '#demo' });
        laydate({ elem: '#demo1' }); //绑定元素
    } ();
</script>

<script type="text/javascript">
    $(function() {
        $('#table')
            .bootstrapTable({
                method: "get",
                striped: true,
                singleSelect: false,

                dataType: "json",
                pagination: true, //分页
                pageSize: 5,
                pageNumber: 1,
                search: false, //显示搜索框
                contentType: "application/x-www-form-urlencoded",
                queryParams: null,
                columns: [
                    {
                        title: "ID",
                        field: 'id',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '学号',
                        field: 'name',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '头像',
                        field: 'star',
                        align: 'center',
                        valign: 'middle'
                    },

                    {
                        title: '联系电话',
                        field: 'phone',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '详细地址',
                        field: 'address',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '昵称',
                        field: 'buildTime',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '操作',
                        field: 'oper',
                        align: 'center',
                        valign: 'middle'
                    }
                ]
            });
    });

    function adduser() {
        this.location.href = ".html";
    }

    function editHotel(id) {
        this.location.href = "addHotel.html";
    }

</script>
<script src="${pageContext.request.contextPath}/layer_v2.1/layer/layer.js"></script>
<script type="text/javascript">
    function openlayer(id) {
        layer.open({
            type: 2,
            title: '添加用户信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: ''
            //iframe的url
        });
    }


    function deleteHotel(dom) {
        alert("删除成功");
        $(dom).parent().parent().remove();
    }

    function showHotelInfo(id)
    {
        layer.open({
            type: 2,
            title: '酒店信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: 'addHotel.html'
            //iframe的url
        });
    }
</script>
</body>
</html>
